package com.jingdianjichi.subject.application.controller;

import com.jingdianjichi.subject.infra.basic.service.SubjectEsServiceSpringBoot;
import com.jingdianjichi.subject.infra.entity.UserInfo;
import com.jingdianjichi.subject.infra.rpc.UserRpc;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 刷题分类controller
 */
@RestController
@RequestMapping("/subject/category")
@Slf4j
public class TestFeignController {

    @Resource
    private UserRpc userRpc;

    @Resource
    private SubjectEsServiceSpringBoot esServiceSpringBoot;



    @GetMapping("testFeign")
    public void testFeign() {
        UserInfo userInfo = userRpc.getUserInfo("jichi");
        log.info("testFeign.userInfo:{}", userInfo);
    }

    @GetMapping("/testCreateIndex")
    public void testCreateIndex() {
       esServiceSpringBoot.createIndex();
    }
    @GetMapping("/addDocs")
    public void addDocs() {
       esServiceSpringBoot.addDocs();
    }
    @GetMapping("/find")
    public void find() {
        esServiceSpringBoot.find();
    }
    @GetMapping("/search")
    public void search() {
        esServiceSpringBoot.search();
    }
}
